﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft;
using GalaSoft.MvvmLight;
using System.ComponentModel;
using PropertyChanged;
using System.Collections.ObjectModel;
using GalaSoft.MvvmLight.Command;

namespace _07_01MvvmLight框架.ViewModel
{
	[AddINotifyPropertyChangedInterface]
	public class AddProductViewModel:ViewModelBase,INotifyPropertyChanged
	{
		public AddProductViewModel()
		{
			this.Message= "MvvmLight";
			this.Messages= new ObservableCollection<string>();
			this.AddMessageCommand = new RelayCommand(AddMessage);
		}

		/// <summary>
		/// 消息文本
		/// </summary>
		public string Message { get; set; }

		/// <summary>
		/// 消息列表
		/// </summary>
		public ObservableCollection<string> Messages { get; set; }

		/// <summary>
		/// 增加一个消息
		/// </summary>
		public RelayCommand AddMessageCommand { get; set; }

		private void AddMessage()
		{
			this.Messages.Add(string.Format("{0} 增加一行新的消息文本！",DateTime.Now.ToString()));
		}



	}
}
